
Page({

  /**
   * 页面的初始数据
   */
  data: {
    array: ['正序','倒序'],
    index:0,
    whid:0,
    logcode:1,
    record:[
    ],
  },

  bindDateChange: function(e) {
    this.setData({
      index: e.detail.value,
    })
    let whid = wx.getStorageSync('warehouseId')
    let logcode=this.data.logcode;
    let desc=this.data.index;
    console.log(this.data.index);
    this.getLog(whid,logcode,desc);
  },
  onLoad: function(){
    let whid = wx.getStorageSync('warehouseId')
    let logcode=this.data.logcode;
    let desc=this.data.index;
    if (whid) {
      this.setData({
        whid,
      })
    }
    this.getLog(whid,logcode,desc);
    
  },
  getLog(whid,logcode,desc){
    let that=this;
    console.log(this.data.record)
    wx.request({
        url: 'http://39.106.9.207:8080/warehouse/GetLog',
        data: {
          whid:whid,
          logcode:logcode,
          desc:desc
        },
        header: {
          'content-type': 'multipart/form-data' // 默认值
        },
        success(res) {
            //成功的回调
            console.log(res.data);
            that.setData({
              record:res.data
            })
        },
        fail(err) {
            //失败的回调
            console.log(err);
        },
      })
 },
})